package com.gl.saasservice.department.controller;

import com.gl.framework.web.response.Result;
import com.gl.saasservice.department.service.DepartmentPersonnelService;
import com.gl.saasservice.house.vo.HouseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 企业部门人员管理
 */
@Controller
@RequestMapping("/departmentPersonnel")
public class DepartmentPersonnelController {

    @Autowired
    private DepartmentPersonnelService departmentPersonnelService;


    /**
     * 查询机构用户列表
     */
    @GetMapping("/list")
    @ResponseBody
    public Result list(@RequestHeader String token,
                            @RequestParam(defaultValue = "1") Integer pageNumber,
                            @RequestParam(defaultValue = "10") Integer pageSize,
                       @RequestParam(value = "departmentname",required = false) String departmentname,
                       @RequestParam(value = "companyName",required = false) String companyName,
                       @RequestParam(value = "userName",required = false) String userName,
                       @RequestParam(value = "phone",required = false) String phone,
                       @RequestParam(value = "position",required = false) String position
                       ) {
        return departmentPersonnelService.list(token, pageNumber, pageSize,departmentname,companyName,userName,phone,position);
    }

    /**
     * 批量删除机构用户
     */
    @PostMapping("/delete")
    @ResponseBody
    public Result delete(@RequestHeader String token,@RequestBody String[] userIds) {
        return departmentPersonnelService.delete(token,userIds);
    }
}
